package com.climb.spingcloud.conver;

import com.climb.spingcloud.dto.OrderDto;
import com.climb.spingcloud.entity.Order;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author Administrator-NANA
 * @date 2021-08-02 14:31:01
 * @description
 */
@Mapper
public interface OrderConvert {
    OrderConvert INSTANCE = Mappers.getMapper(OrderConvert.class);

    Order dto2entity(OrderDto orderDto);
    @Mappings({
            @Mapping(source="userId", target="userId"),
            @Mapping(source="userName", target="userName"),
            @Mapping(source="productName", target="productName"),
            @Mapping(source="productPrice", target="productPrice")
    })
    OrderDto entity2dto(Order order);
    List<OrderDto> entityList2dtoList(List<Order> orders);
    List<Order> dtoList2entityList(List<OrderDto> orderDtos);
}
